import api from "../../utils/request.js";
import {API1_URL} from '../../utils/baseURL.js'

export const getCaptcha = async () => {
    const response = await api({
        url: API1_URL + "/user/captcha",
        method: 'get'
    });
    return response.data;
};

export const postLogin = async (data) => {
    const response = await api({
        url: API1_URL + "/user/login",
        method: 'post',
        data
    });
    return response.data;
};

export const postAdminLogin = async (data) => {
    const response = await api({
        url: API1_URL + "/user/admin/login",
        method: 'post',
        data
    });
    return response.data;
};

export const getUserList = async (params) => {
    const response = await api({
        url: API1_URL + "/user/list",
        method: 'get',
        params
    });
    return response.data;
};

export const getUserInfoById = async (id) => {
    const response = await api({
        url: API1_URL + `/user/list/${id}`,
        method: 'get',
    });
    return response.data;
};

export const postUserUpdateAdmin = async (data) => {
    const response = await api({
        url: API1_URL + '/user/admin/update',
        method: 'post',
        data
    });
    return response.data;
};

export const postUserUpdate1 = async (data) => {
    const response = await api({
        url: API1_URL + '/user/update',
        method: 'post',
        data
    });
    return response.data;
};

export const putUserFreeze = async (params) => {
    const response = await api({
        url: API1_URL + '/user/freeze',
        method: 'put',
        params
    });
    return response.data;
};

export const putUserDisabled = async (data) => {
    const response = await api({
        url: API1_URL + '/user/disabled',
        method: 'put',
        data
    });
    return response.data;
};

export const getUserInfoByIdNo = async () => {
    const response = await api({
        url: API1_URL + '/user/info',
        method: 'get',
    });
    return response.data;
};

export const getUserPasswordCapcha = async (params) => {
    const response = await api({
        url: API1_URL + '/user/update_password/captcha',
        method: 'get',
        params
    });
    return response.data;
};

export const postUserUpdatePassword = async (data) => {
    const response = await api({
        url: API1_URL + '/user/admin/update_password',
        method: 'post',
        data
    });
    return response.data;
};

export const postUserUpdate = async (data) => {
    const response = await api({
        url: API1_URL + '/user/admin/update',
        method: 'post',
        data
    });
    return response.data;
};

export const getMinioPresignedUrl = async (params) => {
    const response = await api({
        url: API1_URL + '/minio/presignedUrl',
        method: 'get',
        params
    });
    return response.data;
};

export const getUserUpdateCapcha = async (params) => {
    const response = await api({
        url: API1_URL + '/user/update/captcha',
        method: 'get',
        params
    });
    return response.data;
};


